package com.mostka.wsrpc.server;

import com.mostka.rpc.server.WsRpcServerServlet;
import com.mostka.rpc.shared.HasClientId;
import com.mostka.wsrpc.client.TestWsClient;
import com.mostka.wsrpc.client.TestWsServer;
import com.mostka.wsrpc.shared.TestObject;

@SuppressWarnings("serial")
public class Server extends WsRpcServerServlet implements TestWsServer {

	public void onJoin(String channel, TestWsClient client) {
		// TODO: implement follow
		System.out.println("+++client connected. id: "+client.getClientId());
		TestObject t = new TestObject();
		t.ddd = new char[]{'a','v'};
		client.clientMethod(t);
        client.testMethod(0,"str",(double) 15.5,(char) 's',(long)54654.6454,(byte)232,false,(short)4);
        client.testMethod(new int[]{1,5},new String[]{"dasda","dasdas"},new double[]{5.5,436.4},new char[]{'d','s'},new long[]{26,546},new byte[]{10,5},new boolean[]{true,false},new short[]{45,654});
	}

	public void onClose(String channel, HasClientId clientId) {

	}

	public void serverMethod(String channel, TestWsClient client, String arg1, int arg2, TestObject objTest) {
		System.out.println("channel: "+channel+", clientId:"+client.getClientId()+", arg1: "+arg1+", arg2: "+arg2);
	}

}
